package com.dongdongshop.data;

public class Result<T> {
    private Integer code;//响应码
    private String message;//相应信息
    private T data;//传递的数据


    //根据传入的不同值，响应不同的结果
    public static Result jsonResponse(HttpResponseEnum responseEnum){
        return new Result(responseEnum.getIndex(),responseEnum.getName());
    }
    public Result() {
    }

    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;

    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public Result setData(T data) {
        this.data = data;
        return this;
    }
}
